﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace kTudu.Web.HTML
{
    public static class LocalLinkExtensions
    {
        /// <summary>
        /// Boton guardar.
        /// </summary>
        ///<remarks>En caso de ser submit requiere que se defina un metodo llamado "submit" que realize el submit del form.
        /// Existe un metodo submit general en asp.net.js, si se requiere logica particular para el submit se debe escribir uno en el js particular de la vista.
        /// </remarks>
        /// <returns></returns>
        public static MvcHtmlString SaveButton(this HtmlHelper html, bool isSubmit = false, string id = "btnGuardar")
        {
            return html.ButtonImage(id, "save", "defaultButton", "Guardar", isSubmit);
        }

        /// <summary>
        /// Boton asignar.
        /// </summary>
        ///<remarks>En caso de ser submit requiere que se defina un metodo llamado "submit" que realize el submit del form.
        /// Existe un metodo submit general en asp.net.js, si se requiere logica particular para el submit se debe escribir uno en el js particular de la vista.
        /// </remarks>
        /// <returns></returns>
        public static MvcHtmlString AssignButton(this HtmlHelper html, bool isSubmit = false, string id = "btnAsignar")
        {
            return html.ButtonImage(id, "assign", "defaultButton", "Asignar", isSubmit);
        }

        /// <summary>
        /// Back Button
        /// </summary>
        ///<remarks>"Index" is the default action 
        /// </remarks>
        public static MvcHtmlString BackToActionButton(this HtmlHelper html, string action = "Index", string controllerName = null, string id = "", object routeValues = null)
        {
            return html.ButtonImageActionLink("Volver", action, controllerName, "back", "defaultButton", id, routeValues);
        }

        /// <summary>
        /// Button to create action
        /// </summary>
        ///<remarks>"Create" is the default action 
        /// </remarks>
        public static MvcHtmlString ToCreateButton(this HtmlHelper html, string createAction = "Create", string controllerName = null, string id = "", object routeValues = null)
        {
            return html.ButtonImageActionLink("Nuevo", createAction, controllerName: controllerName, imageClass: "new", buttonClass: "defaultButton", id: id, routeValues: routeValues);
        }


    }
}